package patterndesign.compositepattern.version2;

public class Leaf implements ILeaf {

    /**
     * 小兵的名字
     */
    private String name;

    /**
     * 小兵的职位
     */
    private String position;

    /**
     * 小兵的薪水
     */
    private int salary = 0;

    /**
     * 构造函数传递小兵信息
     *
     * @param name
     * @param position
     * @param salary
     */
    public Leaf(String name, String position, int salary) {
        this.name = name;
        this.position = position;
        this.salary = salary;
    }

    /**
     * @return 获得小兵信息
     */
    @Override
    public String getInfo() {
        String info = "";
        info = "姓名：" + this.name;
        info = info + "\t职位：" + this.position;
        info = info + "\t薪水：" + this.salary;
        return info;
    }
}
